package com.ssh.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.ssh.model.ProjectBaseInfo;
import com.ssh.service.ProjectBaseInfoService;

public class ProjectBaseInfoAction extends ActionSupport {
	/**
	 * 
	 */
	

	private ProjectBaseInfoService ProjectBaseInfoService;

	private List<ProjectBaseInfo> ProjectBaseInfoList;

	private ProjectBaseInfo ProjectBaseInfo;

	private int id;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public ProjectBaseInfoService getProjectBaseInfoService() {
		return ProjectBaseInfoService;
	}

	public void setProjectBaseInfoService(ProjectBaseInfoService ProjectBaseInfoService) {
		this.ProjectBaseInfoService = ProjectBaseInfoService;
	}

	public List<ProjectBaseInfo> getProjectBaseInfoList() {
		return ProjectBaseInfoList;
	}

	public void setProjectBaseInfoList(List<ProjectBaseInfo> ProjectBaseInfoList) {
		this.ProjectBaseInfoList = ProjectBaseInfoList;
	}

	public ProjectBaseInfo getProjectBaseInfo() {
		return ProjectBaseInfo;
	}

	public void setProjectBaseInfo(ProjectBaseInfo ProjectBaseInfo) {
		this.ProjectBaseInfo = ProjectBaseInfo;
	}

	@Override
	public String execute() throws Exception {
		System.out.println("action accessed");
		return SUCCESS;
	}

	public String addProjectBaseInfo() {
		ProjectBaseInfoService.saveProjectBaseInfo(ProjectBaseInfo);
		return SUCCESS;
	}

	public String modifyProjectBaseInfo() {
		ProjectBaseInfoService.modifyProjectBaseInfo(ProjectBaseInfo);
		return SUCCESS;
	}

	public String selectProjectBaseInfo() {
		ProjectBaseInfo = ProjectBaseInfoService.getProjectBaseInfoById(id);
		return SUCCESS;
	}

	public String deleteProjectBaseInfo() {
		ProjectBaseInfo ProjectBaseInfo = new ProjectBaseInfo();
		ProjectBaseInfo.setId(id);
		ProjectBaseInfoService.deleteProjectBaseInfo(ProjectBaseInfo);
		return SUCCESS;
	}

	public String showProjectBaseInfo() {
		ProjectBaseInfoList = ProjectBaseInfoService.getAllProjectBaseInfos();
		return SUCCESS;
	}
}
